<?php	
						$sql = mysql_query("select * from subcategories where subcategory_id=".$_REQUEST['id']);       
						
						$row= mysql_fetch_array($sql);
						?>
					<form name="edit_subcategory" id="edit_subcategory" method="post" action="edit_subcategory_process.php">
						<table border="0" width="100%" cellspacing="3" cellpadding="2" class="pro">      
							<tr><td colspan="2" class="create">EDIT SUBCATEGORIES</td></tr>
							<tr><td colspan="2" style="height:15px;"></td></tr>
							<tr>
								<td><span class="label">Subcategory:</span></td>
								<td><input  type="text" id="subcat" name="subcat" class="validate[required,custom[noSpecialCaracters],length[0,20]]" value="<?php echo $row['subcategory']; ?>"></td>
								<td><input  type="hidden" id="subcatid" name="subcatid" value="<?php echo $row['subcategory_id']; ?>"></td>
							</tr>
							<?php 
							$c=mysql_query("select * from categories as cat,subcategories as st where st.category_id=cat.category_id and st.subcategory_id=".$row['subcategory_id']); 	
							$tt=mysql_fetch_array($c);
							$c_id=$tt['category_id'];
							$c_name=$tt['category'];

							?>
							<tr>
								<td width="150">Category Name :</td>
								<td><select name="category" id="category" class="validate[required]">
									<?php
									echo "<option value='".$c_id."' selected='selected'>".$c_name."</option>";
									
									$c1=mysql_query("select * from categories");
									while($r=mysql_fetch_array($c1))
									{
										if($r['category_id']!=$c_id)
										{
	 
									   echo "<option value='".$r['category_id']."'>".$r['category']."</option>";
									   }
									
									}

								  ?></option></td>                                   
                                </tr>
							
							<tr>
								<td>&nbsp;</td>
								<td><input type="submit" value="SUBMIT" name="submit" class="sub-butt"/></td>
							</tr>
						</table>
					</form>
					<?php
						//}
					?>
                    </td>                    
                </tr>               
            </table>
        <!--end User Form-->